<?php

namespace App\Http\Controllers;

include_once '/home/zhurongpeng/develop/api_slim/vendor/aliyun-php-sdk-sms/aliyun-php-sdk-core/Config.php';

use Sms\Request\V20160927 as Sms;

class VerifyController
{

    public function store()
    {
        $action = 'SingleSendSms';
        $sign_name = '测试';
        $template_code = 'SMS_52200017';
        $mobile = '13562027693';
        $name = '傻妮儿';

        $iClientProfile = \DefaultProfile::getProfile("cn-hangzhou", "LTAIuAnzqJ3fuVs6", "RkzsHHG08jULkQr9wvurrG02WVxYbN");

        $client = new \DefaultAcsClient($iClientProfile);
        $request = new Sms\SingleSendSmsRequest();

        $request->setSignName($sign_name);
        $request->setTemplateCode($template_code);
        $request->setRecNum($mobile);
        $request->setParamString("{\"name\":\"$name\"}");

        try {
            $response = $client->getAcsResponse($request);
            print_r($response);
        } catch (ClientException  $e) {
            print_r($e->getErrorCode());
            print_r($e->getErrorMessage());
        } catch (ServerException  $e) {
            print_r($e->getErrorCode());
            print_r($e->getErrorMessage());
        }

    }

}
